/**
 * @project KaiBesIMServer
 * @title HtmlData
 * @package com.kaibesim.data
 * @description TODO
 * @author QiuShuiCai
 * @email 414100905@qq.com
 * @version V1.0
 * @date 2014-11-28 下午4:37:30
 */
package com.kaibes.imserver.model.data;

import javax.swing.JScrollPane;
import javax.swing.JTextPane;

/**
 * @className HtmlData
 * @description TODO
 * @author QiuShuiCai
 * @email 414100905@qq.com
 * @date 2014-11-28 下午4:37:30
 *
 */
public class HtmlData {

	private String data;
	private JTextPane textPane;
	private JScrollPane jScrollPane;
	
	public HtmlData() {
		textPane = new JTextPane();
		textPane.setContentType("text/html");
		textPane.setEditable(false);
		jScrollPane = new JScrollPane(textPane);
		data = "";
	}
	
	public JScrollPane getScrollPane(){
		return jScrollPane;
	}
	
	public void add(String str){
		data += "<p style='margin-top: 0'>"+str+"</p>";
		textPane.setText(data);
	}
	
	public void addImg(String str){
		data += "<p style='margin-top: 0'><img src='"+str+"' /></p>";
		textPane.setText(data);
	}
	
	public void cleanData(){
		data = "";
		textPane.setText(data);
	}
}
